package com.huatai.datacenter.entity.postdata;


import com.fasterxml.jackson.core.JsonParser;
import com.fasterxml.jackson.core.JsonToken;
import com.fasterxml.jackson.databind.DeserializationContext;
import com.fasterxml.jackson.databind.JsonDeserializer;
import com.fasterxml.jackson.databind.ObjectMapper;

/**
 * @Author gaowengui
 * @Description //TODO
 * @Date 10:54 2025/6/13
 * @Param
 * @return
 **/
import java.io.IOException;
public  class BodyDataDeserializer extends JsonDeserializer<String> {
		private static final ObjectMapper mapper = new ObjectMapper();

		@Override
		public String deserialize(JsonParser p, DeserializationContext ctxt) throws IOException {
			if (p.currentToken() == JsonToken.START_OBJECT) {
				return mapper.writeValueAsString(p.readValueAsTree());
			} else {
				return p.getValueAsString();
			}
		}
	}